#ifndef CALIBRATION_VIEW_MANUALCALIBRATIONFORM_H
#define CALIBRATION_VIEW_MANUALCALIBRATIONFORM_H

#include <QWidget>
#include "Calibration/BusinessLogic/ManualCalibration.h"
#include "Calibration/Model/ManualCalibViewModel.h"
#include <QCloseEvent>
#include <QShowEvent>
#include <CustomWgt/TableWgt.h>
#include "CustomWgt/LineEditDelegate.h"
#include "Calibration/Model/ManualCalibViewItemDelegate.h"
#include "GlobalApi/GlobalManage.h"

namespace Ui{
  class ManualCalibrationWgt;
}

class ManualCalibrationForm : public QWidget
{
    Q_OBJECT
public:
    explicit ManualCalibrationForm(QWidget *parent = 0);
    ~ManualCalibrationForm();

    void showEvent(QShowEvent *);
    void closeEvent(QCloseEvent *);

    //初始化视图
    void initTableView(QTableView &view);
    //初始化模型，并绑定视图
    void initModel(ManualCalibViewModel &model, QTableView &view, QString tableName, QStringList headlist);
    void init();
    void unInit();
    void closed();

signals:
    
public slots:

private slots:
    void on_pbtFactoryDefault_clicked();

    void on_pbtManuCalibExport_clicked();

    void on_pbtManuCalibImport_clicked();

    void on_pbtManuCalibSave_clicked();

    //void itemChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);

private:
   Ui::ManualCalibrationWgt *ui;
   ManualCalibration *mManualCalibration;

   ManualCalibViewModel mUserWbCalibViewModel;
   ManualCalibViewModel mUserPrediluCalibViewModel;
   ManualCalibViewModel mProdWbCalibViewModel;
   ManualCalibViewModel mProdPrediluCalibViewModel;
   ManualCalibViewModel mTransferWbCalibViewModel;
   ManualCalibViewModel mTransferPrediluCalibViewModel;

   QTableView mUserWbCalibView;
   QTableView mUserPrediluCalibView;
   QTableView mProdWbCalibView;
   QTableView mProdPrediluCalibView;
   QTableView mTransferWbCalibView;
   QTableView mTransferPrediluCalibView;

   ManualCalibViewItemDelegate *delegate;

   ELoginUserType loginUser;

};

#endif // MANUALCALIBRATIONFORM_H
